let stor = localStorage.getItem("token");

// 统一配置
let baseURL = "http://www.itcbc.com:8080";
$.ajaxPrefilter(function (option) {
  let my = option.url.slice(1, 3);
  //1.修改请求的URL
  option.url = baseURL + option.url;
  if (my === "my") {
    option.headers = { Authorization: stor };
  }
  //2.ajax判断token的真假
  option.complete = function (x) {
    let res = x.responseJSON;
    if (res && res.status === 1 && res.message === "身份认证失败") {
      localStorage.removeItem("token");
      window.parent.location.href = "./login.html";
    }
  };
});
